<?php 
if(isset($_POST['submit'])){ 
    require_once('include/db_connection.php');
     
    //Lets search the databse for the user name and password 
    $usr = $_POST['username']; 
    $pas = $_POST['password']; 
	
	$res = $mysqli->query("SELECT * FROM user_table WHERE username='$usr' AND password='$pas' LIMIT 1");
    while ($row = $res->fetch_assoc()) {
        session_start(); 
        $_SESSION['username'] = $row['username']; 
        $_SESSION['fname'] = $row['first_name']; 
        $_SESSION['lname'] = $row['last_name']; 
		$_SESSION['role'] = $row['role']; 
        $_SESSION['logged'] = TRUE; 
        header("Location: dart.php"); // Modify to go to the page you would like 
        exit; 
    }
	header("Location: index.php"); 
	exit; 
    
}else{    //If the form button wasn't submitted go to the index page, or login page 
    header("Location: index.php");     
    exit; 
} 
?>